Add Lambda Durable Functions order processing pattern with CDK#2926
Add Lambda Durable Functions order processing pattern with CDK#2926smyvens wants to merge 6 commits intoaws-samples:mainfrom
Conversation
Review findingsNo pattern metadata JSON file was found in the pattern root directory.Please see https://github.com/aws-samples/serverless-patterns/tree/main/_pattern-model for required files VS Code Configuration Directory CommittedThe .vscode/ directory contains IDE-specific settings that are developer-specific and should not be committed to a community pattern repository. Recommended Fix: rm -rf .vscode/
echo ".vscode/" >> .gitignoreMissing Steps in README
Incorrect Service Name
Folder Casing Mismatch Between CDK Stack and File SystemThe CDK stack references path.join(__dirname, "functions", "allocateInventory", "index.ts") and path.join(__dirname, "functions", "fulfillOrder", "index.ts") but the actual directories are AllocateInventory and FulfillOrder (PascalCase). On case-sensitive file systems (Linux, which Lambda uses), this mismatch will cause deployment failures because the files won't be found. DynamoDB Table Missing RemovalPolicy for Demo PatternThe ProductCatalogTable does not set a removalPolicy. By default, CDK retains DynamoDB tables on stack deletion, which means running cdk destroy will leave an orphaned table incurring storage costs. For a demo/example pattern, RemovalPolicy.DESTROY is more appropriate. Non-Atomic Inventory Check and Update (Race Condition)
Missing CloudWatch Log Retention Policy
Non-Deterministic Date Calls Outside Steps
Nested Durable Step Inside fulfill-order Step
Manual Lambda Invoke Instead of context.invoke()
|
Pattern: lambda-durable-function-chaining-cdk
This pattern demonstrates an e-commerce order processing workflow using AWS Lambda Durable Functions with function chaining, deployed via AWS CDK.
How it works
Processes orders through a 4-step workflow: validation → payment → inventory → fulfillment. The orchestrator function uses durable execution to checkpoint each step, so if something fails, it picks up where it left off instead of starting over.
The payment function fetches pricing from DynamoDB, inventory gets decremented when allocated, and if fulfillment fails, there's compensation logic to put the inventory back.
Architecture